{"ast":null,"code":"export const getUserName = user => {\n  if (user.firstName && user.lastName) {\n    return `${user.firstName} ${user.lastName}`;\n  }\n  return user.firstName || user.lastName || user.nickname;\n};\nconst normalFakeModelProfile = () => {\n  return {\n    id: '0',\n    email: 'test@test.com',\n    nickname: 'nicknameTest',\n    firstName: 'firstNameTest',\n    lastName: 'lastNameTest',\n    verified: true,\n    hideEmail: false,\n    content: {\n      items: [{\n        id: '0',\n        link: 'string',\n        avatar: true\n      }]\n    }\n  };\n};\nexport const profileCompletionPercentage = profile => {\n  var _profile$content;\n  const maxPointer = Object.keys(normalFakeModelProfile()).length + 1;\n  let pointer = 0;\n  Object.values(profile).forEach(item => {\n    if (item) {\n      console.log(item);\n      pointer++;\n    }\n  });\n  if (profile.content && ((_profile$content = profile.content) === null || _profile$content === void 0 ? void 0 : _profile$content.items.length) > 0) {\n    pointer++;\n    console.log(pointer, maxPointer);\n  }\n  return pointer === 0 ? 0 : pointer / maxPointer * 100;\n};","map":{"version":3,"names":["getUserName","user","firstName","lastName","nickname","normalFakeModelProfile","id","email","verified","hideEmail","content","items","link","avatar","profileCompletionPercentage","profile","maxPointer","Object","keys","length","pointer","values","forEach","item","console","log"],"sources":["/data/messenger.client/src/utils/User.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\n\nexport const getUserName = (user: UserListItem): string => {\n    if (user.firstName && user.lastName) {\n        return `${user.firstName} ${user.lastName}`;\n    }\n\n    return user.firstName || user.lastName || user.nickname;\n}\n\nconst normalFakeModelProfile = (): UserListItem => {\n    return ({\n        id: '0',\n        email: 'test@test.com',\n        nickname: 'nicknameTest',\n        firstName: 'firstNameTest',\n        lastName: 'lastNameTest',\n        verified: true,\n        hideEmail: false,\n        content: {\n            items: [\n                {\n                    id: '0',\n                    link: 'string',\n                    avatar: true,\n                }\n            ]\n        }\n    });\n}\n\nexport const profileCompletionPercentage = (profile: UserListItem): number => {\n    const maxPointer: number = Object.keys(normalFakeModelProfile()).length + 1;\n    let pointer: number = 0;\n\n    Object.values(profile).forEach((item) => {\n        if (item!) {\n            console.log(item)\n            pointer++;\n        }\n    });\n\n    if (profile.content && profile.content?.items.length > 0) {\n        pointer++;\n        console.log(pointer, maxPointer)\n    }\n\n    return (pointer === 0)? 0: pointer / maxPointer * 100;\n}"],"mappings":"AAEA,OAAO,MAAMA,WAAW,GAAIC,IAAkB,IAAa;EACvD,IAAIA,IAAI,CAACC,SAAS,IAAID,IAAI,CAACE,QAAQ,EAAE;IACjC,OAAQ,GAAEF,IAAI,CAACC,SAAU,IAAGD,IAAI,CAACE,QAAS,EAAC;EAC/C;EAEA,OAAOF,IAAI,CAACC,SAAS,IAAID,IAAI,CAACE,QAAQ,IAAIF,IAAI,CAACG,QAAQ;AAC3D,CAAC;AAED,MAAMC,sBAAsB,GAAG,MAAoB;EAC/C,OAAQ;IACJC,EAAE,EAAE,GAAG;IACPC,KAAK,EAAE,eAAe;IACtBH,QAAQ,EAAE,cAAc;IACxBF,SAAS,EAAE,eAAe;IAC1BC,QAAQ,EAAE,cAAc;IACxBK,QAAQ,EAAE,IAAI;IACdC,SAAS,EAAE,KAAK;IAChBC,OAAO,EAAE;MACLC,KAAK,EAAE,CACH;QACIL,EAAE,EAAE,GAAG;QACPM,IAAI,EAAE,QAAQ;QACdC,MAAM,EAAE;MACZ,CAAC;IAET;EACJ,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAIC,OAAqB,IAAa;EAAA;EAC1E,MAAMC,UAAkB,GAAGC,MAAM,CAACC,IAAI,CAACb,sBAAsB,EAAE,CAAC,CAACc,MAAM,GAAG,CAAC;EAC3E,IAAIC,OAAe,GAAG,CAAC;EAEvBH,MAAM,CAACI,MAAM,CAACN,OAAO,CAAC,CAACO,OAAO,CAAEC,IAAI,IAAK;IACrC,IAAIA,IAAI,EAAG;MACPC,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;MACjBH,OAAO,EAAE;IACb;EACJ,CAAC,CAAC;EAEF,IAAIL,OAAO,C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